#include <stdio.h>
#include <unistd.h> // for sleep function

void print_progress(int current, int total)
{
    int barWidth = 50; // width of the progress bar
    float progress = (float)current / total;

    printf("[");
    int pos = barWidth * progress;
    for (int i = 0; i < barWidth; ++i)
    {
        if (i < pos)
            printf("=");
        else if (i == pos)
            printf(">");
        else
            printf(" ");
    }
    printf("] %d%%\r", (int)(progress * 100));
    fflush(stdout);
}

int main()
{
    int total = 100;

    for (int i = 0; i <= total; ++i)
    {
        print_progress(i, total);
        usleep(100000); // sleep for 0.1 second
    }
    printf("\n");

    return 0;
}
